home *** CD-ROM | disk | FTP | other *** search
Text File | 2002-05-10 | 32.6 KB | 1,417 lines |
- func i32x SysTest_OnCreate()
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
- var i32x i;
-
- // get this pointer
- pthis = GetThis();
-
- SetComponentNumber(pthis,12);
-
- // Set Data pointer
- pdtData = new Gui_dtPage_SysTest;
- SetData(pthis,pdtData);
-
- // members init
- pdtData.m_iRaceRunning = 0;
- pdtData.m_iHandshake = 0;
- pdtData.m_iWaitForPos = 0;
- pdtData.m_bForceLoad = false;
- pdtData.m_bLogued = false;
-
- // Create System test page
- // Create background
- pdtData.gcBackground = NewMesh(s3dmBackground);
- StretchTo(pdtData.gcBackground,g_iScreenWidth,g_iScreenHeight);
- SetAlign(pdtData.gcBackground,e_GUI_HAlign_Center,e_GUI_VAlign_Center);
-
- // Panel Background
- pdtData.gcTopPanel=NewBitmap(smTopPanel,0);
- SetAlign(pdtData.gcTopPanel,e_GUI_HAlign_Zoom,e_GUI_VAlign_Top);
- StretchTo(pdtData.gcTopPanel,g_iScreenWidth,SizeY(pdtData.gcTopPanel));
- MoveTo(pdtData.gcTopPanel,0,0);
-
- g_iScreenTopOffset = SizeY(pdtData.gcTopPanel);
-
- // Page selector
- pdtData.gcControlTab = NewTabControl();
-
- // Mount component in page
- MountComponent(pthis,pdtData.gcBackground);
- MountComponent(pthis,pdtData.gcTopPanel);
- MountComponent(pthis,pdtData.gcControlTab);
-
- // Construct pages
- MakePages();
-
- pdtData.m_iPageId = g_Page_Start;
- // Add page to TabControl
- i=0;
- while(i<g_iNumPages)
- {
- ptab = g_stPage[i].gcPage;
- pdtData.gcControlTab<<AddTab(ptab);
- i=i+1;
- }
-
- // Display the first page
- if(g_iNumPages>0)
- {
- ptab = g_stPage[g_iFirstPage].gcPage;
- if(g_stPage[g_iFirstPage].bCreated == false)
- {
- ptab<<Create();
- }
- pdtData.gcControlTab<<BackgroundTab(g_Page_Start);
- pdtData.gcControlTab<<ShowTab(g_iFirstPage);
- }
-
- // Global command
- pdtData.gcContextualHelp = NewCaption(smBauer,"Help string");
- StretchTo(pdtData.gcContextualHelp,g_iScreenWidth,SizeY(pdtData.gcContextualHelp));
- SetAlign(pdtData.gcContextualHelp,e_GUI_HAlign_Center,e_GUI_HAlign_Center);
- MountComponent(pthis,pdtData.gcContextualHelp);
- pdtData.gcContextualHelp<<Hide();
-
- pdtData.gcJoinRace = NewCM2Button(GetLocalizedFromKey(iszCourse));
- MountComponent(pthis,pdtData.gcJoinRace);
- MoveTo(pdtData.gcJoinRace,g_iScreenWidth-SizeX(pdtData.gcJoinRace),5);
- pdtData.gcJoinRace<<Hide();
-
-
- // Progress bar
- pdtData.gcProgressBar = NewProgressBar();
- MountComponent(pthis,pdtData.gcProgressBar);
- pdtData.gcProgressBar<<Disable();
- pdtData.gcProgressBar<<Hide();
- MoveTo(pdtData.gcProgressBar,g_iScreenWidthDiv2 - (SizeX(pdtData.gcProgressBar)/2),g_iScreenHeightDiv2 - (SizeY(pdtData.gcProgressBar)/2));
-
- // Hint
- pdtData.gcHint = NewHint();
- MountComponent(pthis, pdtData.gcHint);
-
- // Stretch page
- StretchTo(pthis,g_iScreenWidth,g_iScreenHeight);
-
- }
-
- func void SysTest_OnSendEvent(i32x _iEventType,i32x _iPreRaceCyclistIndex,i32x _iParam1,i32x _iParam2,szx _szParam)
- {
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
- }
-
- func i32x SysTest_OnDestroy()
- {
- // uninit System test page
- print("Destroy System page\n");
- }
-
- func void SysTest_OnRaceDisconnect()
- {
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // Handshake must be done
- pdtData.m_iHandshake = 0;
- pdtData.m_iWaitForPos = 0;
-
- // Tell server to stop sending message
- g_pMenuServerSocket<<mStopUDP();
- // Stop client race
- StopRace();
- }
- func void SysTest_OnRaceConnect()
- {
- //send a message to the menuserver to say i am ready to receive interface,events,sprints
- g_pMenuServerSocket<<mInRaceReady();
- }
-
- func void SysTest_OnDatabaseSync()
- {
- var Gui_Component pthis,gcPage;
- var Gui_dtPage_SysTest pdtData;
- var i32x i;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // For each created page send DBSync
- i=0;
- while(i<g_iNumPages)
- {
- gcPage = g_stPage[i].gcPage;
- if(g_stPage[i].bCreated == true)
- {
- if(gcPage)
- {
- gcPage<<DatabaseSync();
- }
- }
- i=i+1;
- }
-
- if(pdtData.m_bLogued == false)
- {
- // Enable Tab control
- pdtData.gcControlTab<<Enable();
-
- // Hide progress bar
- pdtData.gcProgressBar<<Hide();
-
- pdtData.m_bLogued = true;
- if(g_stPage[g_Page_Start].gcPage)
- g_stPage[g_Page_Start].gcPage<<Logued(true);
- pdtData.m_bForceLoad = true;
-
- if(isDemo())
- {
- println("We are in the demo goto race... ");
- //Go to prerace and set ready
- Database_SetIntData(DATABASE_CLIENT,"GAM_user.fkIDuser_state",ROW_KEY,GetMyUserId(),2);
-
- // Create user form
- pdtData.gcStatus = NewUserVoteForm();
- MountComponent(pthis,pdtData.gcStatus);
- pdtData.gcStatus<<FormFilterByIntEqual("GAM_user.IDuser",GetMyUserId());
- pdtData.gcStatus<<SendRecord(g_pMenuServerSocket,"ReadyDB");
- pdtData.gcStatus<<Hide();
- }
- else
- {
- SysTest_DisplayPage(g_Page_Start);
- // Create user form
- pdtData.gcStatus = NewUserVoteForm();
- MountComponent(pthis,pdtData.gcStatus);
- pdtData.gcStatus<<FormFilterByIntEqual("GAM_user.IDuser",GetMyUserId());
- }
-
- MoveTo(pdtData.gcStatus,g_iScreenWidth-256, 4.0*g_fScreenScaleFactor);
- }
-
- // Update user
- print("SyncDatabase:UserId:"+itoa(GetMyUserId())+"\n");
- }
-
- func void SysTest_DisplayPage(i32x _iPageId)
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- if((pdtData.m_bForceLoad)||(pdtData.m_iPageId != _iPageId))
- {
- pdtData.m_bForceLoad = false;
- // Come from race ?
- if(pdtData.m_iPageId == g_Page_Race)
- {
- pdtData.gcControlTab<<BackgroundTab(g_Page_Start);
- pdtData.gcBackground<<Show();
- pdtData.gcTopPanel<<Show();
- if (isDemo()==0)
- {
- if(pdtData.m_iRaceRunning==1)
- pdtData.gcJoinRace<<Show();
- else
- {
- pdtData.gcJoinRace<<Hide();
- if(pdtData.gcStatus)
- pdtData.gcStatus<<Show();
- }
- }
- }
-
- if(isDemo())
- {
- print("ShowOutro\n");
- _iPageId = g_Page_Outro;
- }
-
- if(g_stPage[_iPageId].bCreated == false)
- {
- ptab = g_stPage[_iPageId].gcPage;
- ptab<<Create();
- g_stPage[_iPageId].bCreated = true;
- }
-
- // Show Page
- pdtData.m_iLastPageId = pdtData.m_iPageId;
- pdtData.m_iPageId = _iPageId;
- if(g_stPage[_iPageId].bDialbox)
- {
- pdtData.gcControlTab<<ShowTabOver(_iPageId);
- }
- else
- {
- pdtData.gcControlTab<<ShowTab(_iPageId);
- }
-
- // Test if last page should be releases (not detroyed)
- if(g_stPage[pdtData.m_iLastPageId].bDestroy)
- {
- // Send release message to page
- g_stPage[pdtData.m_iLastPageId].gcPage<<Release();
- // Page must be recreated
- g_stPage[pdtData.m_iLastPageId].bCreated = false;
- }
- }
- }
-
- func void SysTest_DisplayRace()
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // Prepare Client for race
- // inform c++ to change loop
- StartRace();
-
- // Hide background component
- pdtData.gcControlTab<<BackgroundTab(-1);
- pdtData.gcBackground<<Hide();
- pdtData.gcTopPanel<<Hide();
- pdtData.gcJoinRace<<Hide();
- if(pdtData.gcStatus) pdtData.gcStatus<<Hide();
-
-
- if(g_stPage[g_Page_Race].bCreated == false)
- {
- ptab = g_stPage[g_Page_Race].gcPage;
- ptab<<Create();
- g_stPage[g_Page_Race].bCreated = true;
- }
- pdtData.m_iLastPageId = pdtData.m_iPageId;
- pdtData.m_iPageId = g_Page_Race;
-
- // Show Race Page
- pdtData.gcControlTab<<ShowTab(g_Page_Race);
- }
-
- func void SysTest_Back()
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // Simply return to last page id
- //print("Go back to page:"+itoa(pdtData.m_iLastPageId)+"\n");
- SysTest_DisplayPage(pdtData.m_iLastPageId);
- pdtData.m_iLastPageId = g_Page_Start;
- }
-
-
- func void SysTest_OnClick(Gui_Component _pComponent)
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- if(pdtData.gcJoinRace == _pComponent)
- {
- pthis<<LoadRace();
- }
- }
-
- func void SysTest_OnUpdateGroupsFunc()
- {
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- if(pdtData.m_iPageId == g_Page_Race)
- {
- // Send message to race page
- g_stPage[g_Page_Race].gcPage<<UpdateGroups();
- }
- }
-
-
- func void SysTest_OnLoadRace ()
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
- var i32x iStageId;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // init race client
- iStageId = Join_GetIntFromIndex(g_oMenuJoins.m_iConfig_iCurrentStageId,0);
- print("\tStage "+GetLocalizedFromKey(Join_GetIntFromKey(g_oMenuJoins.m_iStage_iNameId,iStageId))+" Id:"+itoa(iStageId)+"\n");
- print("\tInit race client...\n");
- InitRaceClient(DATABASE_CLIENT, iStageId);
-
- // this will start the udp handshake
- // when it is finished UDPHandshakeFinishedCB is called back
- print("\tStart UDP Handshaking...\n");
- // tutu debug : no udp authorization...
- if(g_oGameConfig.m_iSinglePlayer)
- {
- println("\t\tIp:"+g_oMenuServer.m_szIP);
- println("\t\tPort:"+itoa(g_iInRaceServerPort));
- println("\t\tLogin:Cyanide");
- StartHandshake(g_oMenuServer.m_szIP,g_iInRaceServerPort,"Cyanide");
- }
- else
- {
- println("\t\tIp:"+g_oMenuServer.m_szIP);
- println("\t\tPort:"+itoa(g_iInRaceServerPort));
- println("\t\tLogin:"+Join_GetStringFromIndex( g_oLocalJoins.m_iUser_szName, 0));
- StartHandshake(g_oMenuServer.m_szIP,g_iInRaceServerPort,Join_GetStringFromIndex( g_oLocalJoins.m_iUser_szName, 0));
- }
- }
-
-
- func i32x SysTest_OnUDPHandshakeFinished(i32x _iSuccess)
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- print("\tHandshaking finished...");
-
- if (_iSuccess)
- {
- print(" Ok !\n");
- pdtData.m_iHandshake = 1;
- // ready to receive udp messages
- g_pMenuServerSocket << mStartUDP();
-
- // Start wait for pos
- print("\tWait for position...\n");
- StartWaitForPos();
- }
- else
- {
- print(" Failed : Stop race.\n");
- pdtData.m_iHandshake = 0;
- // destroy race
- StopRace();
- }
- return 1;
- }
-
- func i32x SysTest_OnWaitForPosFinished(i32x _iSuccess)
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- print("\tWait for position finished...");
-
- if (_iSuccess)
- {
- pdtData.m_iWaitForPos = 1;
- print(" Ok !\n");
-
- // Load in race page
- pthis<<DisplayRace();
- }
- else
- {
- pdtData.m_iWaitForPos = 0;
- print(" Failed !\n");
- }
- return 1;
- }
-
- func void SysTest_OnInRaceStop()
- {
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- pdtData.m_iRaceRunning = 0;
- pdtData.gcJoinRace<<Hide();
-
- // Send message to race page if created
- if(g_stPage[g_Page_Race].bCreated)
- {
- g_stPage[g_Page_Race].gcPage<<ShowPodium();
- }
- else
- {
- if(pdtData.gcStatus)
- pdtData.gcStatus<<Show();
- }
- }
-
- func void SysTest_CreateGame(i32x _iGameId)
- {
- var i32x iMode,iDay,iFirstlaunch;
- var szx szDb;
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- var boolx bGateway;
- var szx szGatewayIP;
-
- // tutu debug : no gateway
- bGateway = 0;
- szGatewayIP = "NoIP";
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
-
- if(_iGameId)
- {
- szDb = Join_GetStringFromKey(g_oLocalJoins.m_iSSlot_szDatabase, _iGameId);
- iFirstlaunch = Join_GetIntFromKey( g_oLocalJoins.m_iSSlot_bFirstLaunch,_iGameId);
- iMode = Join_GetIntFromKey( g_oLocalJoins.m_iSSlot_iGameMode, _iGameId);
-
- if ((iMode == 2) && (iFirstlaunch))
- {
- // Race mode : select a specific stage
- iDay = Database_GetIntData(DATABASE_LOCAL, "GAM_slot.fkIDstage.STA_stage.fkIDday", ROW_KEY, _iGameId);
- }
- else
- {
- iDay = 1;
- }
- }
- else
- {
- szDb = "Database/Demo.cdb";
- iFirstlaunch = 0;
- iMode = 1;
- iDay = 0;
- }
-
-
-
- // Disable Tab control avoid page change
- pdtData.gcControlTab<<Disable();
-
- // Show progress bar
- pdtData.gcProgressBar<<Show();
-
- // create menu server
- CreateMenuServer( bGateway, szGatewayIP, szDb, iFirstlaunch, iMode, iDay );
-
- // Game is no more new
- if(_iGameId)
- {
- Join_SetIntFromKey( g_oLocalJoins.m_iSSlot_bFirstLaunch,_iGameId,0);
- }
-
- // admin is automatically connected to the menu server
- g_oMenuServer.m_szIP = "127.0.0.1";
- g_oMenuServer.m_iPort = g_iServerPort;
- g_pMenuServerSocket = NetClient_Create( g_oMenuServer.m_szIP, g_oMenuServer.m_iPort, g_gcManager );
- }
-
- func i32x SysTest_OnGainFocus()
- {
- // Take focus
- return 1;
- }
- func i32x SysTest_OnKeyDown(i32x _iKey,i32x _iCount)
- {
- return 1;
- }
-
- func void SysTest_OnQuitGame()
- {
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
-
- if(isDemo())
- {
- ExitNow();
- }
-
- // Destroy user form
- pdtData.gcStatus = DeleteComponent(pdtData.gcStatus);
- pdtData.gcStatus = NULL;
-
- // Disconnect from server if needed
- if(g_pMenuServerSocket)
- {
- NetClient_Disconnect(g_pMenuServerSocket);
- }
- pdtData.m_bLogued = false;
- g_stPage[g_Page_Start].gcPage<<Logued(false);
- pdtData.m_bForceLoad = true;
- SysTest_DisplayPage(g_Page_Start);
- }
-
- func void SysTest_OnExitGame()
- {
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
- print("Exitgame2\n");
-
- // Exit cycling manager 2
- ExitNow();
- }
-
-
- func void SysTest_OnInRaceStart(i32x _iInRaceTeamID)
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- println("Can start race with TeamID:" + itoa(_iInRaceTeamID));
-
- pdtData.m_iRaceRunning = 1;
- if(pdtData.gcStatus) pdtData.gcStatus<<Hide();
- if (isDemo()==0)
- {
- pdtData.gcJoinRace<<Show();
- }
- }
-
- func void SysTest_ShowHelp(szx _szHelp)
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- if(strcmp(pdtData.m_szHelp,_szHelp))
- {
- pdtData.gcContextualHelp<<Caption(_szHelp);
- pdtData.gcContextualHelp<<Show();
- }
- }
-
-
- func void SysTest_ShowHint(szx _szText)
- {
- var Gui_Component pthis, phint;
- var Gui_dtPage_SysTest pdtPage;
- pthis = GetThis();
- pdtPage = GetData(pthis);
- phint = pdtPage.gcHint;
-
- phint<<HintSet(_szText);
-
- var Gui_dtHintTimer pdtTimer;
- pdtTimer = new Gui_dtHintTimer;
-
- AddInterface(phint, Gui_iHintTimer, pdtTimer);
- }
-
- func void SysTest_MoveHint(i32x _AbsX, i32x _AbsY)
- {
- var Gui_Component pthis, phint;
- var Gui_dtPage_SysTest pdtPage;
- var Gui_dtHint pdtHint;
- var Menu_Sprite sprite;
- pthis = GetThis();
- pdtPage = GetData(pthis);
- phint = pdtPage.gcHint;
-
- pdtHint = GetPrimaryData(phint);
-
- var i32x posX, posY;
-
- if ((_AbsX + 32 + pdtHint.iWidth + 5) <= g_iScreenWidth)
- posX = _AbsX + 32;
- else
- posX = g_iScreenWidth - pdtHint.iWidth - 5;
-
- if ((_AbsY + 32 + pdtHint.iHeight) <= g_iScreenHeight)
- posY = _AbsY + 32;
- else
- posY = _AbsY - pdtHint.iHeight;
-
- MoveTo(phint, posX, posY);
- }
-
- func void SysTest_HideHint()
- {
- var Gui_Component pthis, ptab, phint, pcomponent;
- var Gui_dtPage_SysTest pdtPage;
- var Gui_dtHint pdtHint;
- pthis = GetThis();
- pdtPage = GetData(pthis);
- phint = pdtPage.gcHint;
- phint<<HintReset();
- }
-
-
-
- func void SysTest_HideHelp()
- {
- var Gui_Component pthis,ptab;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- pdtData.gcContextualHelp<<Hide();
- }
-
-
-
-
- func void AddHelpInterface(Gui_Component _pComponent,szx _szCaption)
- {
- var Gui_dtHelpData pdtData;
- pdtData=new Gui_dtHelpData;
- pdtData.szCaption=_szCaption;
- //println("AddHelpInterface "+_szCaption);
- AddInterface(_pComponent,Gui_iHelpInterface,pdtData);
- }
-
- func i32x HelpInterface_OnMouseEnter(i32x _iX,i32x _iY)
- {
- var Gui_dtHelpData pdtData;
- pdtData=GetData(GetThis());
-
- if(strlen(pdtData.szCaption)>=1)
- {
- g_gcManager<<MoveHint(_iX,_iY);
- g_gcManager<<ShowHint(pdtData.szCaption);
- g_cCurrentHelpComponent=GetThis();
- }
- return 1;
- }
-
-
- func i32x HelpInterface_OnMouseLeave(i32x _iX,i32x _iY)
- {
- var Gui_dtHelpData pdtData;
- pdtData=GetData(GetThis());
-
- if(strlen(pdtData.szCaption)>=1)
- {
- if(g_cCurrentHelpComponent==GetThis())
- {
- g_gcManager<<HideHint();
- g_cCurrentHelpComponent=NULL;
- }
- }
- return 1;
- }
-
-
- func i32x HelpInterface_OnSetHelpString(szx _szHelp)
- {
- var Gui_dtHelpData pdtData;
- pdtData=GetData(GetThis());
- pdtData.szCaption=_szHelp;
-
- if(strlen(pdtData.szCaption)>=1)
- {
- if(g_cCurrentHelpComponent==GetThis())
- {
- g_gcManager<<HideHint();
- g_gcManager<<ShowHint(pdtData.szCaption);
- }
- }
- }
-
-
-
-
- func void SysTest_OnProgress(szx _szMessage,f32x _fValue)
- {
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // Update progress bar
- pdtData.gcProgressBar<<Progress(_szMessage,_fValue);
- }
- func void SysTest_OnLoadProgress(szx _szMessage,f32x _fValue)
- {
- // print(_szMessage+":"+ftoa(_fValue)+"\n");
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
- var f32x fCurrentTime;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // Update progress bar
- fCurrentTime = GetPerformanceTimer();
- if(IsHidden(pdtData.gcProgressBar))
- {
- pdtData.m_fLastTime = 0.0;
- pdtData.gcProgressBar<<Show();
- }
-
- if((fCurrentTime-pdtData.m_fLastTime)>(1.0/60.0))
- {
- pdtData.m_fLastTime = fCurrentTime;
- // Make menu one loop
- pdtData.gcProgressBar<<Progress(_szMessage,_fValue);
- ProgressLoop();
- }
- }
- func void SysTest_OnEndLoadProgress()
- {
- var Gui_Component pthis;
- var Gui_dtPage_SysTest pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // Update progress bar
- if(!IsHidden(pdtData.gcProgressBar))
- pdtData.gcProgressBar<<Hide();
- }
-
-
- func void ProgressBar_OnProgress(szx _szMessage,f32x _fValue)
- {
- var Gui_Component pthis;
- var Gui_dtDialog_ProgressBar pdtData;
-
- pthis = GetThis();
-
- pdtData = GetData(pthis);
-
- // Update caption
- pdtData.gcMessage<<Caption(_szMessage);
- // Update gauge
- pdtData.gcGauge<<GaugeValue(_fValue);
- }
- func void ProgressBar_OnEndProgress()
- {
- var Gui_Component pthis,parent;
- var Gui_dtDialog_ProgressBar pdtData;
-
- pthis = GetThis();
-
- pdtData = GetData(pthis);
-
- }
-
- func Gui_Component NewProgressBar()
- {
- var Gui_Component pthis;
- var Gui_dtDialog_ProgressBar pdtData;
-
- pdtData = new Gui_dtDialog_ProgressBar;
-
- // New object
- pthis = NewObject(Gui_iDialog_ProgressBar);
- SetData(pthis,pdtData);
-
- // Background
- pdtData.gcBackground = NewBoxFilled(smWhiteFrame,350.0*g_fScreenScaleFactor,150.0*g_fScreenScaleFactor);
- pdtData.gcBackground<<BoxSetColor(cLoadingBackColor);
- MountComponent(pthis,pdtData.gcBackground);
-
- // Message
- pdtData.gcMessage = NewCaption(smLoadingFont, GetLocalizedFromKey(iszWait));
- StretchTo(pdtData.gcMessage,350.0*g_fScreenScaleFactor,150.0*g_fScreenScaleFactor);
- SetColor(pdtData.gcMessage, cLoadingFontColor);
- SetAlign(pdtData.gcMessage,e_GUI_HAlign_Center,e_GUI_VAlign_Top);
- MountComponent(pthis,pdtData.gcMessage);
-
- // Gauge
- pdtData.gcGauge = NewGaugeH(smHGauge, 300.0*g_fScreenScaleFactor, 32);
- MountComponent(pthis,pdtData.gcGauge);
- pdtData.gcGauge<<GaugeValue(0);
- pdtData.gcGauge<<GaugeColor(cLoadingGaugeColor);
- MoveTo(pdtData.gcGauge,25.0*g_fScreenScaleFactor,150.0*g_fScreenScaleFactor-48);
-
- StretchTo(pthis,350.0*g_fScreenScaleFactor,150.0*g_fScreenScaleFactor);
- return pthis;
- }
-
- func Gui_Component NewUserVoteForm()
- {
- var Gui_Component pform;
- var Gui_dtForm_User pdtData;
- var i32x i,iPosX;
- var szx szTxt;
-
- iPosX = 0;
- pform = NewForm(DATABASE_CLIENT,"GAM_user",false);
- pform<<FormSetDecimal(0);
- pform<<FormSetAlign(e_GUI_HAlign_Center,e_GUI_VAlign_Center);
- pform<<FormSetOffset(2);
-
- pdtData = new Gui_dtForm_User;
- AddInterface(pform,Gui_iForm_User,pdtData);
-
- pform<<FormSetLocked(true);
- pform<<FormSetTitle(false,false);
- pform<<FormSetFontColor(cBlack,cBlack);
- pform<<FormSetLocked(false);
- pform<<FormSetWidth(200);
- pform<<FormSetMaJInform(true);
- pform<<FormShowGroupOptionField("GAM_user.fkIDuser_state","STA_user_state.IDuser_state","STA_user_state.gene_strID_state","",0,0);
- pdtData.gcState = GetLastField(pform);
- pform<<FormSetMaJInform(false);
-
- return pform;
- }
-
- func Gui_Component NewUserListForm()
- {
- var Gui_Component pform;
- var Gui_dtForm_UserList pdtData;
- var i32x i,iPosX;
- var szx szTxt;
-
- pdtData = new Gui_dtForm_UserList;
-
- // New list form
- pform = NewListForm(DATABASE_CLIENT,"GAM_user",false);
-
- AddInterface(pform,Gui_iForm_UserList,pdtData);
-
- return pform;
- }
- func void UserListForm_OnAddForm(Gui_Component _pform,i32x _iIndex)
- {
- var Gui_dtForm_UserList pdtData;
- var i32x i,iPosX;
- var szx szTxt;
-
- iPosX = 0;
- _pform<<FormSetDecimal(0);
- _pform<<FormSetAlign(e_GUI_HAlign_Center,e_GUI_VAlign_Center);
- _pform<<FormSetOffset(2);
- _pform<<FormSetLocked(true);
- _pform<<FormSetTitle(false,false);
- _pform<<FormSetWidth(100);
- _pform<<FormShowField("GAM_user.game_sz_login","",iPosX,0);
- iPosX = iPosX + 100;
- _pform<<FormSetWidth(148);
- _pform<<FormSetMaJInform(false);
- _pform<<FormShowField("GAM_user.fkIDuser_state.STA_user_state.gene_strID_state","",iPosX,0);
- }
- func void UserForm_OnMaJInt(Gui_Component _poField,i32x _iValue,i32x _bChanged)
- {
- var Gui_Component pthis,pback;
- var Gui_dtForm_User pdtData;
-
- if(_bChanged)
- {
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- if(_poField == pdtData.gcState)
- {
- pthis<<SendRecord(g_pMenuServerSocket,"ReadyDB");
- }
- }
- }
-
- func void ShowContextualHelp(szx _szHelp)
- {
- // Send message to manager component
- g_gcManager<<ShowHelp(_szHelp);
- }
- func void HideContextualHelp()
- {
- // Send message to manager component
- g_gcManager<<HideHelp();
- }
-
-
- // Data class
- class Gui_dtDbgObject
- {
- var Gui_Component gcCaption;
- var Gui_Component gcBorder;
- };
-
- // Debug object
- func Gui_Component NewDebugObject()
- {
- var Gui_Component caption,container,composite;
- var Gui_dtDbgObject pdtData;
-
- // Create an object that will contain Bitmap buton + caption
- composite = NewObject(Gui_iDbgObject);
- pdtData = new Gui_dtDbgObject;
- SetData(composite,pdtData);
-
-
- // Two component in composite button
- SetComponentNumber(composite,2);
-
- // Create A caption Button
- caption = NewCaption(smArial,"");
- SetScale(caption,0.5);
-
- // Create a bitmap
- container = NewBitmap(smWhite,0);
- StretchTo(container,g_iScreenWidth,g_iScreenHeight);
- SetFillMode(GetSprite(container),DLC_Fill_Wireframe);
- SetAlign(container,e_GUI_HAlign_Zoom,e_GUI_VAlign_Zoom);
-
- // Disable caption
- caption<<Disable();
- container<<Disable();
-
- // Mount containers into object
- MountComponent(composite,container);
- MountComponent(composite,caption);
-
- pdtData.gcCaption = caption;
- pdtData.gcBorder = container;
-
- // Stretch composite
- StretchTo(composite,g_iScreenWidth,g_iScreenHeight);
-
- return composite;
- }
- func i32x Debug_OnDebug(szx _szEvent,i32x _iPosX,i32x _iPosY,i32x _iSizeX,i32x _iSizeY)
- {
- var Gui_Component pthis,ptab;
- var Gui_dtDbgObject pdtData;
-
- // get this pointer
- pthis = GetThis();
-
- // Get Data pointer
- pdtData = GetData(pthis);
-
- // Affect new text to caption
- pdtData.gcCaption<<Caption(_szEvent);
-
- StretchTo(pdtData.gcBorder,_iSizeX,_iSizeY);
- MoveTo(pdtData.gcBorder,_iPosX,_iPosY);
- }
- func i32x Debug_OnDestroy()
- {
- print("Destroy_Debug Object\n");
- }
- /*
- * Page definition
- */
- func void MakePages()
- {
- var Gui_Component gcPage;
- var i32x i;
- i=0;
-
- // Start page
- g_stPage[i].gcPage = NewObject(Gui_iPage_Start);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Start = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Roster);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Roster = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_RosterCyclist);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_RosterCyclist = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_RosterStaff);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_RosterStaff = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_TeamInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_MedicalDistrib = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_MedicalReports);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_MedicalReports = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_MedicalDiagram);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_MedicalDiagram = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Season);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Season = i;
- i=i+1;
-
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Finance);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Finance = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_FinanceContracts);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_FinanceContracts = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_FinanceReports);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_FinanceReports = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_FinanceStatement);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_FinanceStatement = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_News);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_News = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Palmares);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Palmares = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Classification);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_Classification = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Training);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Training = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_TrainingSeason);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_TrainingSeason = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_TrainingWeek);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_TrainingWeek = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_PreRace);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_PreRace = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_PreRaceSelection);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_PreRaceSelection = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_PreRaceStrategy);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_PreRaceStrategy = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_PreRaceEquipment);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_PreRaceEquipment = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_CyclistInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_Page_CyclistInfo = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_StaffInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_StaffInfo = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_TeamInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_TeamInfo = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_ManagerInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_ManagerInfo = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_RaceInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_RaceInfo = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_StageInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_StageInfo = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_ClassInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_ClassInfo = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_SponsorInfo);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_SponsorInfo = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_ChatRoom);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_ChatRoom = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Race);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_Race = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Init);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Init = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_NewGame);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_New = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_JoinGame);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Join = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_InitLoad);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = false;
- g_stPage[i].bDestroy = false;
- g_stPage[i].bDialbox = false;
- g_Page_Load = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Intro);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_Intro = i;
- i=i+1;
-
- g_stPage[i].gcPage = NewObject(Gui_iPage_Outro);
- g_stPage[i].bCreated = false;
- g_stPage[i].bDynamic = true;
- g_stPage[i].bDestroy = true;
- g_stPage[i].bDialbox = false;
- g_Page_Outro = i;
- i=i+1;
-
- //print("NumPage:"+itoa(i)+"\n");
- g_iNumPages = i;
- // First page index
- g_iFirstPage = g_Page_Start;
- g_iFirstPage = g_Page_Intro;
-
- // Create static page
- i=0;
- while(i<g_iNumPages)
- {
- gcPage = g_stPage[i].gcPage;
- gcPage<<InitData();
- if(g_stPage[i].bDynamic == false)
- {
- gcPage<<Create();
- g_stPage[i].bCreated = true;
- }
- i=i+1;
- }
- }
-
-